home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
NEWSOFT
/
AUGUST
/
WORKDISC
/
!Forthmacs
/
risc_os
/
whatis
< prev
next >
Wrap
Text File
|
1997-02-25
|
2KB
|
71 lines
\ whatis_doc extraction for Risc_OS
decimal
only forth also hidden definitions
: w_doc p" <Forthmacs$Dir>.risc_os.whatis_doc" ;
: w_ind p" <Forthmacs$Dir>.risc_os.whatis_ind" ;
128 32 - cells constant /index
/index buffer: index
260 buffer: linebuf
variable index-read index-read off
: ?read-index ( filename -- )
index-read @ 0=
if w_ind read-open
index /index erase
index /index ifd @ fgets
/index <> if -331 throw then
ifd @ fclose
index-read on
then ;
: dropline ( -- ) newline ifd @ fskiptill ;
: getline ( -- line ) linebuf newline ifd @ fgettill ;
: showit ( str -- ) ". space getline ". cr getline ". cr ;
: (>index ( str -- adr ) char+ c@ bl - cells index + ;
: >index ( str -- off) (>index @ ;
: file-search ( str -- str found? )
begin pad ifd @ fgetword over "=
if true exit then dropline dropline
eof? if false exit then
again ;
: no-help ( str -- )
". d# -614 .error cr ;
: (whatis ( str -- )
?read-index
w_doc read-open
dup >index ( str file-offset) dup 0<
if drop no-help
else ifd @ fseek ( str)
file-search ( str flag)
if showit else no-help then
then
ifd @ fclose ;
variable tell-index
: indexes (s -- )
index /index erase
w_doc read-open ifd @ 0= if d# -332 throw then
begin eof? 0=
while ifd @ ftell >r
getline dup >index
if drop
else (>index r@ swap !
then
dropline r> drop
repeat ifd @ fclose ifd off
w_ind new-file
index /index ofd @ fputs ofd @ fclose ofd off ;
only forth hidden also forth definitions
: (cold-hook (cold-hook index-read off ; ' (cold-hook is cold-hook
: whatis \ word ( -- )
blword (whatis ;
only forth also definitions